![]() |
PATH![]() |
![]() ![]() |
You may have existing code that saves the state of the graphics port before changing the background or pen, and restores the state after drawing. When adopting theme brushes, you should convert your code to use Appearance Manager functions to save and restore all graphics port state values that can be modified by the theme brush, including pixel patterns and other state information that is not typically accessible to applications.
To obtain the current graphics port state values, you can call the function GetThemeDrawingState before performing an operation that modifies the drawing state of a graphics port. To return the graphics port to its previous drawing state and release the memory allocated for the drawing state reference, you can call SetThemeDrawingState , providing the reference obtained in the outState parameter of GetThemeDrawingState . You can also call DisposeThemeDrawingState to release the allocated memory.
The function NormalizeThemeDrawingState sets the current graphics port to a default drawing state. NormalizeThemeDrawingState sets the background of a graphics port to white; the pen of the port to a size of 1 pixel by 1 pixel, a pattern mode of patCopy , and a pattern of black; and the text mode of the port to srcOr . The NormalizeThemeDrawingState function also flushes from memory any color foreground or background patterns saved in the port's GrafPort.pnPat or GrafPort.bkPat fields, respectively.